<?php
include_once('common/header.php');
if($AppUI->id <= 0 || (isset($_SESSION['origduct']) && ($_SESSION['origduct'] <= 0))) {
	$this->_redirect(HOST_BACKEND);
}
$intLanguage	= $objRequest->getParam('lg', 0);
$intStatus		= $objRequest->getParam('stt', -1);
$strStart		= $objRequest->getParam('startdate', '');
$strEnd			= $objRequest->getParam('enddate', '');
$intPage		= $objRequest->getParam('page', 1);
$intCancel		= $objRequest->getParam('pcancel', 0);
$intLimit		= ADMIN_LIMIT;
$intOff			= (($intPage-1) * $intLimit);
$intTotal		= 0;
if($intCancel) {
	$intLanguage	= 0;
	$intStatus		= -1;	
	$strStart		= '';
	$strEnd			= '';
}
$objOrigin		= new Origin(); 
$arrResult		= $objOrigin->getAll($AppUI->type, $intLanguage, $intStatus, PhungTK_Function::convertStrToDate($strStart), PhungTK_Function::convertStrToDate($strEnd), $intOff, $intLimit, $intTotal);
if($intOption != 0 || $strKey != '' || $strStart != '' || $strEnd != '') {
	$_SESSION['origcancel'] 	= 1;	
	$_SESSION['origpost']	= $objRequest->getParams();
}
else {
	if(isset($_SESSION['origpost'])) unset($_SESSION['origpost']);
	if(isset($_SESSION['origcancel'])) unset($_SESSION['origcancel']);
}
if($intCancel) {
	if(isset($_SESSION['origpost'])) unset($_SESSION['origpost']);
	if(isset($_SESSION['origcancel'])) unset($_SESSION['origcancel']);
}
# list
$this->view->arrResult		= $arrResult;
$this->view->intTotal		= $intTotal;
$this->view->intOffset		= $intOff;
$this->view->intLimit		= $intLimit;
$this->view->strUrl			= PhungTK_Function::getUrl(HOST_BACKEND);
$this->view->arrStatus		= $AppUI->type > 1 ? $arrStatusAd : $arrStatus;
$this->view->intLanguage	= $intLanguage;
$this->view->intStatus		= $intStatus;
?>